package com.dfbz.service.impl;

import com.dfbz.dao.LoginDao;
import com.dfbz.entity.User;
import com.dfbz.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl extends IServiceImpl<User> implements LoginService {

    @Autowired
    LoginDao loginDao;

    public User findByUser(String username) {
        User dbUser = loginDao.findByUser(username);
        return dbUser;
    }


    public void register(User user) {
        loginDao.register(user);
    }

    public void save(String newPassWord, String userEmail) {
        loginDao.save(newPassWord,userEmail);
    }

    public Integer codeCheck(String email) {
       Integer dbEmailCount= loginDao.findByEmailCount(email);
       return dbEmailCount;
    }
}
